// 分页查询,附带排序和查询某些字段
import { Allow, IsInt } from 'class-validator';
import { FindOptionsOrder } from 'typeorm/find-options/FindOptionsOrder';
import { FindOptionsRelations } from 'typeorm/find-options/FindOptionsRelations';

export class PageQuery<T> {
  @IsInt()
  pageSize: number; // 每页多少个数据
  @IsInt()
  currentPage: number; // 当前页

  @Allow()
  order?: FindOptionsOrder<T>;

  @Allow()
  cache?: boolean | number;

  @Allow()
  relations?: FindOptionsRelations<any>;

  @Allow()
  query?: Partial<T>;
}
